<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>前端监控</title>
    <!-- <link rel="stylesheet" href=""> -->
  </head>
  <body>
    <div id="container">
      <div id="content">
        <input
          id="errorBtn"
          type="button"
          value="点击报错"
          onclick="errorClick()"
        />
        <input
          id="promiseErrorBtn"
          type="button"
          value="点击抛出Promise报错"
          onclick="promiseErrorClick()"
        />
      </div>
    </div>
    <script>
      function errorClick() {
        window.someVar.error = "error";
      }
      function promiseErrorClick() {
        new Promise(function (resolve, reject) {
          window.someVar.error = "error";
          // reject('err')
        }).then(
          (res) => {
            console.log("+++ ", res);
          },
          (error) => {
            console.log(error);
          }
        );
      }
    </script>
    <script src="error.js"></script>
  </body>
</html>
